const  path  =  require('path')
function resolve(dir) {
    return path.join(__dirname, dir)
}

module.exports = {
    
    //声明配置webpack
    chainWebpack:(config)=>{
        config.resolve.alias
            .set('@',resolve('./src'))
            .set('@assets',resolve('./src/assets'))
            .set('@views',resolve('./src/views'))
    },
    
    //端口映射配置(前端发送给后端请求映射url)
    devServer:{
        host:'localhost',
        port:8080,
        proxy:{
            '/':{
                ws:false,
                target:'http://localhost:9999',
                changeOrigin:true,
                //是否重写路径
                pathReWrite:{
                    '^/':'/'
                }
            },

            '/ws':{
                ws:true,
                target:'ws://localhost:9999'
            }
        }
    },

}